/*
    指针函数，函数指针
*/
#include <iostream>
#include <string>
using namespace std;

// 指针函数:函数的返回值为指针类型
string foo() {
    string a = "hello";
    return a;
}

int add(int a, int b) {
    return a + b;
}

int sub(int a, int b) {
    return a - b;
}

void success(int (*add)(int, int)) {

}

int main(int argc, char const *argv[])
{
    int (*p)(int, int) = add;
    cout << p(4, 2) << endl;

    p = sub;
    cout << p(40, 20) << endl;
    return 0;
}